News All Tests
Current file: /home/estudydev/workspace/MSP09/web/news/tests/class.resource.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 17
6.06 %6.06%
6.06% 4 / 66
 
Resource
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 17
1.64 %1.64%
1.64% 1 / 61
 public function getID()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function setFileManager($fileManager)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function getFileManager()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function setCreateTime($createTime)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function setDescription($description)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function getDescription()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function setFileID($fileID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function setCourseID($courseID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function getCourseID()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function setUserID($userID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function setLink($link)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function setVisibleType($visibleType)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function setName($name)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function getName()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getLink()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 protected function getRessourceVisibilityHTML()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 29
 public static function createLink($oldOnes = true, $vars = '', $link = '')
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 7


       1                 : <?php                                                                                                                                                                                                                                  
       2                 : /*--------------------------------------------------------------------------+                                                                                                                                                          
       3                 : This file is part of eStudy.                                                                                                                                                                                                           
       4                 : ressourcen/classes/filemanager/class.folder.inc.php                                                                                                                                                                                    
       5                 : - Modulgruppe:  File Manager                                                                                                                                                                                                           
       6                 : - Beschreibung: Klasse "Folder"                                                                                                                                                                                                        
       7                 : - Version:      0.4, 08.01.08                                                                                                                                                                                                          
       8                 : - Autor(en):    Tobias Wild <tobias.wild@mni.fh-giessen.de>                                                                                                                                                                            
       9                 : +---------------------------------------------------------------------------+                                                                                                                                                          
      10                 : This program is free software; you can redistribute it and/or                                                                                                                                                                          
      11                 : modify it under the terms of the GNU General Public License                                                                                                                                                                            
      12                 : as published by the Free Software Foundation; either version 2                                                                                                                                                                         
      13                 : of the License, or any later version.                                                                                                                                                                                                  
      14                 : +---------------------------------------------------------------------------+                                                                                                                                                          
      15                 : This program is distributed in the hope that it will be useful,                                                                                                                                                                        
      16                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                                                                                                                         
      17                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                                                                                                                                          
      18                 : GNU General Public License for more details.                                                                                                                                                                                           
      19                 : You should have received a copy of the GNU General Public License                                                                                                                                                                      
      20                 : along with this program; if not, write to the Free Software                                                                                                                                                                            
      21                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                                                                                                                                            
      22                 : +--------------------------------------------------------------------------*/                                                                                                                                                          
      23                 :                                                                                                                                                                                                                                        
      24               1 : if ( !defined("PATH_TO_ROOT") ) {                                                                                                                                                                                                      
      25               0 :     define( "PATH_TO_ROOT", "../../../" );                                                                                                                                                                                             
      26               0 : }                                                                                                                                                                                                                                      
      27                 :                                                                                                                                                                                                                                        
      28               1 : require_once ("class.ressourcendb.inc.php");                                                                                                                                                                                           
      29               1 : require_once ("class.filemanger.inc.php");                                                                                                                                                                                             
      30                 :                                                                                                                                                                                                                                        
      31               1 : abstract class Resource {                                                                                                                                                                                                              
      32                 :     protected $fileID;                                                                                                                                                                                                                 
      33                 :     protected $courseID;                                                                                                                                                                                                               
      34                 :     protected $userID;                                                                                                                                                                                                                 
      35                 :     protected $link;                                                                                                                                                                                                                   
      36                 :     protected $name;                                                                                                                                                                                                                   
      37                 :     protected $visibleType;                                                                                                                                                                                                            
      38                 :     protected $createTime;                                                                                                                                                                                                             
      39                 :     protected $description;                                                                                                                                                                                                            
      40                 :                                                                                                                                                                                                                                        
      41                 :     protected $fileManager = null;                                                                                                                                                                                                     
      42                 :                                                                                                                                                                                                                                        
      43                 :     public function getID() {                                                                                                                                                                                                          
      44               0 :         return $this->fileID;                                                                                                                                                                                                          
      45                 :     }                                                                                                                                                                                                                                  
      46                 :                                                                                                                                                                                                                                        
      47                 :     public function setFileManager( $fileManager ) {                                                                                                                                                                                   
      48               0 :         $this->fileManager = $fileManager;                                                                                                                                                                                             
      49               0 :     }                                                                                                                                                                                                                                  
      50                 :                                                                                                                                                                                                                                        
      51                 :     public function getFileManager() {                                                                                                                                                                                                 
      52               0 :         return $this->fileManager;                                                                                                                                                                                                     
      53                 :     }                                                                                                                                                                                                                                  
      54                 :                                                                                                                                                                                                                                        
      55                 :     public function setCreateTime( $createTime ) {                                                                                                                                                                                     
      56               0 :         $this->createTime = $createTime;                                                                                                                                                                                               
      57               0 :     }                                                                                                                                                                                                                                  
      58                 :                                                                                                                                                                                                                                        
      59                 :     /**                                                                                                                                                                                                                                
      60                 :      * Setter for description                                                                                                                                                                                                          
      61                 :      *                                                                                                                                                                                                                                 
      62                 :      * @param String $description Description                                                                                                                                                                                          
      63                 :      */                                                                                                                                                                                                                                
      64                 :     public function setDescription ( $description ) {                                                                                                                                                                                  
      65               0 :         $this->description = $description ;                                                                                                                                                                                            
      66               0 :     }                                                                                                                                                                                                                                  
      67                 :                                                                                                                                                                                                                                        
      68                 :     /**                                                                                                                                                                                                                                
      69                 :      * Getter for description                                                                                                                                                                                                          
      70                 :      *                                                                                                                                                                                                                                 
      71                 :      * @return String Description                                                                                                                                                                                                      
      72                 :      */                                                                                                                                                                                                                                
      73                 :     public function getDescription() {                                                                                                                                                                                                 
      74               0 :         return $this->description;                                                                                                                                                                                                     
      75                 :     }                                                                                                                                                                                                                                  
      76                 :                                                                                                                                                                                                                                        
      77                 :     public function setFileID ( $fileID ) {                                                                                                                                                                                            
      78               0 :         $this->fileID = $fileID;                                                                                                                                                                                                       
      79               0 :     }                                                                                                                                                                                                                                  
      80                 :                                                                                                                                                                                                                                        
      81                 :     public function setCourseID ( $courseID ) {                                                                                                                                                                                        
      82               0 :         $this->courseID = $courseID;                                                                                                                                                                                                   
      83               0 :     }                                                                                                                                                                                                                                  
      84                 :                                                                                                                                                                                                                                        
      85                 :     /**                                                                                                                                                                                                                                
      86                 :      * Getter for course id.                                                                                                                                                                                                           
      87                 :      *                                                                                                                                                                                                                                 
      88                 :      * @return Integer Course id                                                                                                                                                                                                       
      89                 :      */                                                                                                                                                                                                                                
      90                 :     public function getCourseID () {                                                                                                                                                                                                   
      91               0 :         return $this->courseID;                                                                                                                                                                                                        
      92                 :     }                                                                                                                                                                                                                                  
      93                 :                                                                                                                                                                                                                                        
      94                 :     public function setUserID ( $userID ) {                                                                                                                                                                                            
      95               0 :         $this->userID = $userID;                                                                                                                                                                                                       
      96               0 :     }                                                                                                                                                                                                                                  
      97                 :                                                                                                                                                                                                                                        
      98                 :     public function setLink ( $link ) {                                                                                                                                                                                                
      99               0 :         $this->link = $link;                                                                                                                                                                                                           
     100               0 :     }                                                                                                                                                                                                                                  
     101                 :                                                                                                                                                                                                                                        
     102                 :     public function setVisibleType ( $visibleType ) {                                                                                                                                                                                  
     103               0 :         $this->visibleType = $visibleType;                                                                                                                                                                                             
     104               0 :     }                                                                                                                                                                                                                                  
     105                 :                                                                                                                                                                                                                                        
     106                 :     public function setName ( $name ) {                                                                                                                                                                                                
     107               0 :         $this->name = $name;                                                                                                                                                                                                           
     108               0 :     }                                                                                                                                                                                                                                  
     109                 :                                                                                                                                                                                                                                        
     110                 :     public function getName() {                                                                                                                                                                                                        
     111               0 :         return $this->name;                                                                                                                                                                                                            
     112                 :     }                                                                                                                                                                                                                                  
     113                 :                                                                                                                                                                                                                                        
     114                 :     public function getLink() {                                                                                                                                                                                                        
     115               0 :         return $this->link;                                                                                                                                                                                                            
     116                 :     }                                                                                                                                                                                                                                  
     117                 :                                                                                                                                                                                                                                        
     118                 :     protected function getRessourceVisibilityHTML() {                                                                                                                                                                                  
     119               0 :                 $visibleSelect = "<div class='res_file-extra'>"."Sichtbarkeit &auml;ndern: <br/>";                                                                                                                                     
     120               0 :                 $activeFolder = $this->fileManager->getActiveFolder();                                                                                                                                                                 
     121               0 :                 $action = $this->fileManager->getAction();                                                                                                                                                                             
     122               0 :                 $actionID = $this->fileManager->getActionID();                                                                                                                                                                         
     123               0 :                 if (isset($_GET['mode'])) {                                                                                                                                                                                            
     124               0 :                     $mode = $_GET['mode'];                                                                                                                                                                                             
     125               0 :                     $mode1 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityDocentsOnly", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten</a>&nbsp;&nbsp;&nbsp;";           
     126               0 :                     $mode2 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityNoStudents", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten und Tutoren</a>&nbsp;&nbsp;&nbsp;";
     127               0 :                     $mode3 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityAll", 'actionID' => $actionID, 'mode' => $mode)) ."'>Alle</a>&nbsp;&nbsp;&nbsp;";                       
     128               0 :                 } else {                                                                                                                                                                                                               
     129               0 :                     $mode = 1;                                                                                                                                                                                                         
     130               0 :                     $mode1 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityDocentsOnly", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten</a>&nbsp;&nbsp;&nbsp;";           
     131               0 :                     $mode2 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityNoStudents", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten und Tutoren</a>&nbsp;&nbsp;&nbsp;";
     132               0 :                     $mode3 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityAll", 'actionID' => $actionID, 'mode' => $mode)) ."'>Alle</a>&nbsp;&nbsp;&nbsp;";                       
     133                 :                 }                                                                                                                                                                                                                      
     134               0 :                 if ($mode == 1) {                                                                                                                                                                                                      
     135               0 :                     switch ($this->visibleType) {                                                                                                                                                                                      
     136               0 :                         case 3: //nur für Dozenten                                                                                                                                                                                    
     137               0 :                             $visibleSelect.= "<b>Dozenten</b>&nbsp;&nbsp;&nbsp;".$mode2.$mode3;                                                                                                                                        
     138               0 :                             break;                                                                                                                                                                                                     
     139                 :                                                                                                                                                                                                                                        
     140               0 :                         case 2: // Dozenten und Tutoren                                                                                                                                                                                
     141               0 :                             $visibleSelect.= $mode1."<b>Dozenten und Tutoren</b>&nbsp;&nbsp;&nbsp;".$mode3;                                                                                                                            
     142               0 :                             break;                                                                                                                                                                                                     
     143                 :                                                                                                                                                                                                                                        
     144               0 :                         case 1: // Alle                                                                                                                                                                                                
     145               0 :                             $visibleSelect.= $mode1.$mode2."<b>Alle</b>&nbsp;&nbsp;&nbsp;";                                                                                                                                            
     146               0 :                             break;                                                                                                                                                                                                     
     147               0 :                     }                                                                                                                                                                                                                  
     148               0 :                 } else $visibleSelect.= $mode1.$mode2.$mode3;                                                                                                                                                                          
     149               0 :                 $visibleSelect.= "<a href='".$this->createLink(0, array("activeFolder" => $activeFolder)) ."'>Abbrechen</a>&nbsp;&nbsp;&nbsp;".Utilities::helpCode(700) ."</div>";                                                     
     150               0 :                 return $visibleSelect;                                                                                                                                                                                                 
     151                 :     }                                                                                                                                                                                                                                  
     152                 :                                                                                                                                                                                                                                        
     153                 :                                                                                                                                                                                                                                        
     154                 :      /**                                                                                                                                                                                                                               
     155                 :      * Erstellt einen Link mit GET Variablen                                                                                                                                                                                           
     156                 :      *                                                                                                                                                                                                                                 
     157                 :      * @param bool [$oldOnes] Gibt an ob bisher existierende GET Variablen mit in den Link eingebaut werden.                                                                                                                           
     158                 :      * @param array [$vars] Ein Array (Aufbau wie $_GET) mit den Variabeln und WErten die in den Link eingebaut werden                                                                                                                 
     159                 :      * @param string [$link] Falls nicht PHP_SELF das Ziel ist muss hier der Dateiname angegeben werden.                                                                                                                               
     160                 :      * @return string Zusammengesetzter Link                                                                                                                                                                                           
     161                 :      * @access private                                                                                                                                                                                                                 
     162                 :      */                                                                                                                                                                                                                                
     163                 :     public static function createLink($oldOnes = true, $vars = '', $link = '') {                                                                                                                                                       
     164               0 :         if ($link == "") $link = PATH_TO_ROOT.SCRIPT_NAME;                                                                                                                                                                             
     165               0 :         if (!is_array($vars)) $vars = $_GET;                                                                                                                                                                                           
     166               0 :         elseif (count($_GET) > 0 && $oldOnes) $vars = array_merge($_GET, $vars);                                                                                                                                                       
     167               0 :         foreach($vars as $getVarName => $getVarValue) {                                                                                                                                                                                
     168               0 :             if (trim($getVarValue) != "" && isset($getVarValue)) $getVars[] = urlencode($getVarName) ."=".urlencode($getVarValue);                                                                                                     
     169               0 :         }                                                                                                                                                                                                                              
     170               0 :         return $link."?".implode($getVars, "&amp;");                                                                                                                                                                                   
     171                 :     }                                                                                                                                                                                                                                  
     172                 :                                                                                                                                                                                                                                        

Generated by PHPUnit 3.2.21 and Xdebug 2.0.4 at Sat Nov 7 22:04:08 CET 2009.